package com.tdx.blog_nowcoder.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/student")
public class StudentController {
    @RequestMapping(path = "/list/{id}") // /studnet/list/1
    @ResponseBody
    public String getStudent(@PathVariable("id") int id){
        return "hello student" +id;
    }


    @RequestMapping(path = "/list") // /studnet/list?tdx=tdx
    @ResponseBody
    public String getStudent2(@RequestParam(name = "tdx",required = false,defaultValue = " ") String name){
        return "hello student " +name;
    }

    @RequestMapping(path = "/test") // /studnet/list?tdx=tdx

    public String test(@RequestParam(name = "tdx",required = false,defaultValue = " ") String name){
        return "test/test";
    }

}
